#ifndef TMRTMPCTRL_H
#define TMRTMPCTRL_H

#include <QObject>
#include "AnyCore/RtmpHoster.h"
#include "AnyCore/RtmpGuester.h"
#include <QDebug>
#include <QLabel>

class MyHostCallBack : public RTMPHosterEvent
{
    // RTMPHosterEvent interface
public:
    void OnRtmpStreamOK(){
        qDebug()<<"RTMPHosterEvent"<<"ok";
    }
    void OnRtmpStreamReconnecting(int times){
        qDebug()<<"RTMPHosterEvent"<<"Reconnecting"<<times;
    }
    void OnRtmpStreamStatus(int delayMs, int netBand){
        qDebug()<<"RTMPHosterEvent"<<"Status"<<delayMs<<netBand;
    }
    void OnRtmpStreamFailed(int code){
        qDebug()<<"RTMPHosterEvent"<<"Failed"<<code;
    }
    void OnRtmpStreamClosed(){
        qDebug()<<"RTMPHosterEvent"<<"Closed";
        // start Timer and try again
    }
};
class MyGuesterCallback : public RTMPGuesterEvent{
    // RTMPGuesterEvent interface
public:
    void OnRtmplayerOK(){
        qDebug()<<"RTMPGuesterEvent"<<"ok";
    }
    void OnRtmplayerStatus(int cacheTime, int curBitrate){
        qDebug()<<"RTMPGuesterEvent"<<"Status"<<cacheTime<<curBitrate;
    }
    void OnRtmplayerCache(int time){
        qDebug()<<"RTMPGuesterEvent"<<"Cache"<<time;
    }
    void OnRtmplayerClosed(int errcode){
        qDebug()<<"RTMPGuesterEvent"<<"close"<<errcode;
    }
};


class TMRTMPCtrl : public QObject
{
    Q_OBJECT
public:
    explicit TMRTMPCtrl(QObject *parent = 0);


signals:

public slots:
    void slot_getVideoLive(QString m_ip,QLabel *pWidget);
    void slot_stopVideoLive();
    void slot_startAudioLive(QString m_ip);
    void slot_stopAudioLive();
private:
    RTMPHoster *m_pAVRtmpstreamer;
    RTMPGuester	*m_pAVRtmplayer;
};

#endif // TMRTMPCTRL_H
